package com.example.patient.controller;

import com.example.common.entity.EscortProduct;
import com.example.common.entity.EscortReserve;
import com.example.common.support.Result;
import com.example.patient.dto.req.AppointmentEscortReserve;
import com.example.patient.dto.req.GetEscortProductList;
import com.example.patient.dto.resp.EscortProductList;
import com.example.patient.dto.resp.EscortReserveList;
import com.example.patient.dto.resp.EscortTypeList;
import com.example.patient.service.EscortReserveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @ClassName EscortReserveController
 * @Author wengjt
 * @Date 2021/5/7 17:20
 * @Description
 **/
@RestController
@Api(tags = "陪护预约服务")
@RequestMapping("/escortReserve")
public class EscortReserveController {
    @Resource
    private EscortReserveService escortReserveService;

    @GetMapping("/escortProduct/list")
    @ApiOperation(value = "预约套餐列表")
    public Result<EscortProductList> getEscortProductList(GetEscortProductList dto) {
        return Result.success(escortReserveService.getEscortProductList(dto));
    }

    @GetMapping("/escortProduct/info")
    @ApiOperation(value = "套餐详情")
    public Result<EscortProduct> getEscortProduct(Long cpId) {
        return Result.success(escortReserveService.getEscortProduct(cpId));
    }

    @GetMapping("escortType/list")
    @ApiOperation(value = "套餐类型列表")
    public Result<EscortTypeList> getEscortTypeList(Long etId, Integer showAble, Integer pageNum, Integer pageSize) {
        return Result.success(escortReserveService.getEscortTypeList(etId, showAble, pageNum, pageSize));
    }

    @PostMapping("/appointment")
    @ApiOperation(value = "陪护预约")
    public Result<Object> appointmentEscortReserve(@RequestBody AppointmentEscortReserve dto,@RequestHeader(value = "uid") Long uid) {
        return Result.success(escortReserveService.appointmentEscortReserve(uid,dto.getPId(), dto.getProductId(), dto.getBeginTime(), dto.getEndTime(), dto.getCaregiverGender(), dto.getLinkMan(), dto.getLinkTel()));
    }
    @GetMapping("/list")
    @ApiOperation(value = "获取病患陪护订单列表")
    public Result<EscortReserveList> getEscortReserveList(Integer rStatus,Integer pageNum,Integer pageSize,@RequestHeader(value = "uid")Long uid){
        return Result.success(escortReserveService.getEscortReserveList(uid,rStatus,pageNum,pageSize));
    }
}
